﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AUV5.Web.Handler
{
    /// <summary>
    /// Summary description for CheckMessageHandler
    /// </summary>
    public class CheckMessageHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string userid = context.Request["userID"] ?? "";

            context.Response.Write(CheckMessage(userid));

        }

        private string CheckMessage(string userid)
        {
            IList<Model.Message> list = BLL.MessageBLL.Instance.GetUnReadMessage(userid);
            return list.Count > 0 ? "1" : "0";
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}